#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include <time.h>
int main()
{
	float pi = 3.14159;
	initgraph(1200, 800);
	setbkcolor(RGB(128, 128, 128));
	cleardevice();
	srand(time(0));

	int centreX = 300;
	int centreY = 300;
	int radius = 200;
	int i;
	float offset;
	float totaloffset;

	while (1)
	{
		for (centreX = 200; centreX < 1200; centreX = centreX + 400)
		{
			for (centreY = 200; centreY < 800; centreY = centreY + 400)
			{
				totaloffset = 0;
				float h = rand() % 180;
				COLORREF color1 = HSVtoRGB(h, 0.9, 0.8);
				COLORREF color2 = HSVtoRGB(h + 180, 0.9, 0.8);

				for (radius = 200; radius > 0; radius = radius - 50)
				{
					int left = centreX - radius;
					int top = centreY - radius;
					int right = centreX + radius;
					int bottom = centreY + radius;

					for (i = 0; i < 20; i++)
					{
						offset = i * pi / 10 + totaloffset;
						setfillcolor(color1);
						solidpie(left, top, right, bottom, offset, 2 * pi / 60 + offset);
						setfillcolor(RGB(255, 255, 255));
						solidpie(left, top, right, bottom, 2 * pi / 60 + offset, 3 * pi / 60 + offset);
						setfillcolor(color2);
						solidpie(left, top, right, bottom, 3 * pi / 60 + offset, 5 * pi / 60 + offset);
						setfillcolor(RGB(0, 0, 0));
						solidpie(left, top, right, bottom, 5 * pi / 60 + offset, 6 * pi / 60 + offset);
					}
					totaloffset = totaloffset + pi / 20;
				}
			}
		}

	_getch();
}
	return 0;
}